/**
 * 本地状态存储
 */
import { defineStore } from "pinia";
import { StoreID } from "@/config";
import { persistedStateConfig } from "@/config";

/**
 * 本地状态存储
 * @description 使用 config
 */
export const useLocaleStore = defineStore(StoreID.LOCALE_STORE, {
    state: (): LocaleState => {
        return {
            languageKey: "en",
            languageMap: [
                {
                    lang: "zh-cn",
                    name: "简体中文",
                    icon: "sunny",
                },
                {
                    lang: "en",
                    name: "English",
                    icon: "edit",
                },
            ],
        };
    },

    getters: {},

    actions: {},

    // 可以选择需要存储的键
    persist: persistedStateConfig(StoreID.LOCALE_STORE, ["languageKey"]),
});
